<?php
header("Content-type:application/json");
include("../conn/conn.php");

 $json=file_get_contents("php://input");
 $arr=json_decode($json,true);
 $username=$arr['username'];
 $code=$arr['code'];
 $cl=(int)$arr['cl'];
 $c=$cl+1;
 $pwd=$arr['pwd'];
 $date=date("Y-m-d,H:i:s",time());
 $i="INSERT into grad_user(`username`,`code`,`cl`,`pwd`,`date`) values('$username','$code','$c','$pwd','$date') ";
 $re=mysqli_query($link,$i);
 if($re){
     $res=array(
       'code'=>200,
       'msg'=>'注册成功'
     );
 }else{
    $res=array(
     'code'=>201,
     'msg'=>'注册失败'
   );
 }
 echo json_encode($res,true);
